package pro;

import freemarker.template.TemplateException;
import pro.shuangxi.generator.Generator;
import pro.shuangxi.source.TemplateMapSource;

import java.io.IOException;

/**
 * @author mengshx
 **/
public class Main {
    public static void main(String[] args) throws IOException, TemplateException {
        TemplateMapSource source = new TemplateMapSource("jdbc:mysql:///test?useInformationSchema=true", "root", "admin", "test");
        source.setAuthor("mengshx");
        source.setPackage("pro.shuangxi.test");
        Generator generator = new Generator(source);
        generator.setOutputPath("render");
        generator.render("test-template");

//        Configuration configuration = new Configuration(Configuration.getVersion());
//        configuration.setDirectoryForTemplateLoading(new File("E:\\work\\Tools\\src\\main\\resources\\templates"));
//        configuration.setEncoding(Locale.CHINA, "utf-8");
//        Template template = configuration.getTemplate("temp.ftl");
//
//        Environment environment = template.createProcessingEnvironment(data, new FileWriter("E:\\work\\Generator\\pom2.xml"));
//        environment.process();
    }
}
